﻿using Furion.CMS.Application.Dto;
using Furion.CMS.Core;
using Mapster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Furion.CMS.Profile
{
    /// <summary>
    /// 全局映射配置文件
    /// </summary>
    public class GlobalProfile : IRegister
    {
        public void Register(TypeAdapterConfig config)
        {
            #region Enum Maps
            config.ForType<Enum, EnumOptionDto>()
                    .Map(dest => dest.Code, src => src.ToString())
                    .Map(dest => dest.Value, src => src)
                    .Map(dest => dest.Label, src => src.GetDescription());
            #endregion
        }
    }
}
